package com.lfy.Factor;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class MonFactorBean2 {
    private static Map<String,Object> map = new HashMap<>();
    static {
        Properties properties = new Properties();

        InputStream r = MonFactorParse.class.getResourceAsStream("/"+"a.properties");
        try {
            properties.load(r);
        } catch (IOException e) {
            e.printStackTrace();
        }
        for (Object o : properties.keySet()) {
            String className = properties.getProperty((String) o);
            try {
                MonFactorParse o1 = (MonFactorParse) Class.forName(className).newInstance();
                map.put((String) o,o1);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
                e.printStackTrace();
            }
        }
    }
    private MonFactorBean2(){

    }

    public static MonFactorParse getBean(String name){
        return (MonFactorParse)map.get(name);
    }
}
